import xadmin
from .models import NovelCategory, Novel, NovelChapter


class NovelCategoryAdmin(object):
    list_display = ["id", "name", "url", "sequence"]
    search_fields = ['name', ]


class NovelAdmin(object):
    list_display = ["id", "name", "author", "url", "img_url", "publish_date",
                    "publish_state", "desc", "sequence", "update_chapter", "update_chapter_url", "novel_category"]
    style_fields = {"desc": "ueditor"}


class NovelChapterAdmin(object):
    list_display = ["id", "name", "url", "content", "sequence", "state","novel"]
    style_fields = {"content": "ueditor"}


xadmin.site.register(NovelCategory, NovelCategoryAdmin)
xadmin.site.register(Novel, NovelAdmin)
xadmin.site.register(NovelChapter, NovelChapterAdmin)
